package cn.mill.core.modem;

import java.lang.reflect.Type;

import cn.mill.common.Context;
import cn.mill.common.data.Item;

public class BaseSpell implements FieldSpell {
	public static final BaseSpell INSTANCE = new BaseSpell();
	
	@Override
	public Item resolver(Context context, String name, Type type, Object object) {
		Item item = new Item();
		item.setName(name);
		item.setType(type);
		item.setValue(String.valueOf(object));
		return item;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public <T> T builder(Type type, Item item) {
		return (T) String.valueOf(item.getValue());
	}
	
}
